---
title: Pressable | gluestack-ui | Installation, Usage, and API

description: By providing access to hover, pressed, and focus events, Pressable serves as a more flexible alternative to buttons at a lower level of abstraction. It is a useful primitive for advanced customization needs.

pageTitle: Pressable

pageDescription: By providing access to hover, pressed, and focus events, Pressable serves as a more flexible alternative to buttons at a lower level of abstraction. It is a useful primitive for advanced customization needs.

showHeader: true
---

import { Meta } from '@storybook/addon-docs';

<Meta title="ui/Components/Forms/Pressable" />

import { Pressable } from './Pressable';
import { transformedCode } from '../../../utils';
import { AppProvider, CodePreview, Text } from '@gluestack/design-system';

import Wrapper from '../../Wrapper';

This is an illustration of a **Themed Pressable** component with default configuration.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
 <Pressable
  onPress={() => console.log('Hello')} p="$5" bg="$primary500" $hover-bg="$primary400">
  <Text color="white">Press me</Text>
</Pressable>
`,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Wrapper,
        Pressable,
        Text,
      },
      argsType: {},
    }}
  />
</AppProvider>

<br />

## API Reference

### Import

To use this component in your project, include the following import statement in your file.

```bash
import { Pressable } from '@gluestack-ui/themed';
```

### Anatomy

The structure provided below can help you identify and understand a Pressable component's various parts.

```jsx
export default () => <Pressable />;
```

### Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

#### Pressable

It inherits all the properties of React Native's [Pressable](https://reactnative.dev/docs/pressable) component.

### Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

#### Pressable child elements according to its states

You can change the child elements according to the states of Pressable component.

<AppProvider>
  <CodePreview
    showComponentRenderer={true}
    showArgsController={false}
    metaData={{
      code: `
 <Pressable p="$16" bg="$primary500"  $hover-bg="$primary400">
   {({ pressed }) => (
        <Text color={pressed ? 'pink' : 'yellow'}>PRESSABLE</Text>
      )}
</Pressable>
`,
      transformCode: (code) => {
        return transformedCode(code);
      },
      scope: {
        Wrapper,
        Pressable,
        Text,
      },
      argsType: {},
    }}
  />
</AppProvider>

Similarly, you can change the child elements according to other states of Pressable
component and i.e. `focus` , `hover` , `pressed` , `disabled` and `focusVisible`.

## Unstyled

All the components in `gluestack-ui` are unstyled by default. To customize your UI using the extendedTheme, please refer to this [link](https://gluestack.io/ui/docs/theme-configuration/customizing-theme/eject-library). The import names of components serve as keys to customize each component.

<!--
### Customizing the Pressable

For customizing the Pressable, you have to map styled view to Pressable. You can refer [gluestack.io/style](/style) for more information on how to use styled components.

#### Usage

Default styling of the component can be found in the `components/pressable` file. For reference, you can view the [source code](https://github.com/gluestack/gluestack-ui/blob/main/packages/themed/src/components/Pressable) of the styled `Pressable` component.

```jsx
// import the styles
import { Root } from '../components/core/pressable/styled-components';

// mapping the Pressable to root component
const Pressable = Root;

// using the Pressable component
export default () => <Pressable />;
```

-->
